#[[
This source file is part of the Swift Atomics Open Source Project

Copyright (c) 2021 - 2025 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
#]]

add_library(Atomics
  "Types/UnsafeAtomicLazyReference.swift"
  "Types/DoubleWord.swift"
  "Types/ManagedAtomic.swift"
  "Types/ManagedAtomicLazyReference.swift"
  "Types/AtomicMemoryOrderings.swift"
  "Types/UnsafeAtomic.swift"
  "Types/autogenerated/IntegerOperations.swift"
  "Unmanaged extensions.swift"
  "Primitives/autogenerated/Primitives.native.swift"
  "Conformances/RawRepresentable.swift"
  "Conformances/OptionalRawRepresentable.swift"
  "Conformances/autogenerated/IntegerConformances.swift"
  "Conformances/autogenerated/PointerConformances.swift"
  "Conformances/autogenerated/AtomicBool.swift"
  "Protocols/AtomicInteger.swift"
  "Protocols/AtomicValue.swift"
  "Protocols/AtomicReference.swift"
  "Protocols/AtomicOptionalWrappable.swift"
  "Protocols/AtomicStorage.swift")

set_target_properties(Atomics PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
target_compile_options(Atomics PUBLIC
  "$<$<COMPILE_LANGUAGE:Swift>:SHELL:${ATOMICS_SWIFT_FLAGS}>"
  "$<$<COMPILE_LANGUAGE:C,CXX>:SHELL:${ATOMICS_C_FLAGS}>")  
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
  target_compile_options(Atomics PUBLIC
    "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -mcx16>")
endif()
target_link_libraries(Atomics PUBLIC
  _AtomicsShims)

_install_target(Atomics)
set_property(GLOBAL APPEND PROPERTY SWIFT_ATOMICS_EXPORTS Atomics)
